import api from "@/api";
export default {
  //解决命名空间冲突
  namespaced: true,
  state: {
    students: [],
    total: 0,
  },
  mutations: {
    SET_STUDENTS(state, payload) {
      state.students = payload.rows;
      state.total = payload.total;
    },
  },
 
  actions: {
    async getStudentsAsync({commit}, payload) {
        //调用api 的方法
      const res = await api.students.get(payload);
      if (res.code) {
        console.log(res.data);
        commit("SET_STUDENTS", res.data);
      }
    },
  },
};
